package com.chinalife.project.config;

import com.chinalife.project.util.GsonUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.GsonHttpMessageConverter;

/**
 * @description 自动配置类
 * @author synhard
 * @date 2024/7/18 13:32
 * @email songxinhang2023@e-chinalife.com
 * @id 18101119
 * @phone 13001321080
 */
@Configuration
public class GsonMsgConverterConfig {

    /**
     * @author synhard
     * @id 18101119
     * @description 注册 gson 做为 http 请求和响应的序列化
     * @date 2024/3/25 17:06
     * @param
     * @return org.springframework.http.converter.json.GsonHttpMessageConverter
     */
    @Bean
    public GsonHttpMessageConverter gsonHttpMessageConverter() {
        GsonHttpMessageConverter converter = new GsonHttpMessageConverter();
        converter.setGson(GsonUtil.getGson());
        return converter;
    }
}